/* eslint-disable react-hooks/exhaustive-deps */
import { Tooltip, Tag, Grid } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import React, { useState, useEffect } from 'react';
import { connect, history } from 'umi';
import Avatar from './AvatarDropdown';
import HeaderSearch from '../HeaderSearch';
import styles from './index.less';
const { useBreakpoint } = Grid;

const ENVTagColor = {
  dev: 'orange',
  test: 'green',
  pre: '#87d068',
};

const GlobalHeaderRight = (props) => {
  const { theme, layout, global, dispatch } = props;
  let className = styles.right;
  const screens = useBreakpoint();

  if (theme === 'dark' && layout === 'top') {
    className = `${styles.right}  ${styles.dark}`;
  }
  // global

  useEffect(() => {
    dispatch({
      type: 'global/fetchlocalpath',
      payload: {},
    });
  }, []);

  return (
    <div className={className}>
      {screens.md ? <b style={{ fontStyle: 'italic' }}>会计连锁直营服务机构</b> : <a />}
      <div className="center">
        <a
          href={global?.localpath}
          target="_blank"
          style={{ fontStyle: 'italic', marginRight: 12 }}
          rel="noreferrer"
        >
          公司文化墙
        </a>
        <Avatar />
      </div>
    </div>
  );
};

export default connect(({ settings, global }) => ({
  theme: settings.navTheme,
  layout: settings.layout,
  global,
}))(GlobalHeaderRight);
